import { Text, View } from '@tarojs/components';
import { HouseConstant } from '@/constant/HouseConstant';
import { HouseEntity } from '@/entities/HouseEntity';
import './index.less';
import { LeaseEntity } from '@/entities/LeaseEntity';

interface IProps {
  houses?: HouseEntity.IResultHouse | LeaseEntity.IHouseLease;
}

const ShowCollectFees = (props: IProps) => {
  const {houses} = props;
  // 房屋收费标准展示字段
  const collectFees = ['price', 'waterFee', 'electricityFee', 'internetFee', 'fuelFee', 'depositNumber', 'priceNumber'];

  return (
    <>
      <View className='collect-fees-container'>
        <View className='title font-bold'>收费标准</View>
        {
          collectFees.map((item: string, idx: number) => {
            return (
              <View key={ idx } className='info-item'>
                <Text className='text'>{ HouseConstant.FieldToNameMap[item] }</Text>
                <View>
                  <Text className='collect-fees-content'>
                    { item !== 'priceNumber' && item !== 'depositNumber' ? '￥' : null }
                    { houses?.[item] }
                  </Text>
                  <Text className='unit'>{ HouseConstant.FieldToUnit[item] }</Text>
                </View>
              </View>
            );
          })
        }
      </View>
    </>
  );
};

export default ShowCollectFees;